home *** CD-ROM | disk | FTP | other *** search
/ BMUG Revelations / BMUG Revelations.toast / Programming / Programming Languages / Harvest C / MPW Int & Lib / Interfaces / FCntl.h < prev    next >
Text File  |  1991-04-17  |  3KB  |  107 lines

  1. /*
  2.  * FCntl.h -- faccess(), fcntl(), and open() mode flags
  3.  *
  4.  * Portions copyright American Telephone & Telegraph
  5.  * Used with permission, Apple Computer Inc. (1985,1988,1990)
  6.  * All rights reserved.
  7.  */
  8.  
  9. #ifndef __FCNTL__
  10. #define __FCNTL__
  11.  
  12. /*
  13.  *    For use by lseek():
  14.  */
  15.  
  16. #ifndef __STDIO__            /* these defns exactly paralled in StdIO.h for fseek() */
  17. #define SEEK_CUR    1
  18. #define SEEK_END    2
  19. #define SEEK_SET    0
  20. #endif
  21.  
  22. /*
  23.  * faccess() commands; for general use
  24.  */
  25.                      /* 'd' => "directory" ops */
  26. #define F_DELETE        (('d'<<8)|0x01)
  27. #define F_RENAME        (('d'<<8)|0x02)
  28.  
  29. /*
  30.  * more faccess() commands; for use only by MPW tools
  31.  */
  32.  
  33. #define F_OPEN             (('d'<<8)|0x00)        /* reserved for operating system use */
  34.                     /* 'e' => "editor" ops */
  35. #define F_GTABINFO         (('e'<<8)|0x00)        /* get tab offset for file */    
  36. #define F_STABINFO         (('e'<<8)|0x01)        /* set     "    "        "    "  */
  37. #define F_GFONTINFO        (('e'<<8)|0x02)        /* get font number and size for file */
  38. #define F_SFONTINFO        (('e'<<8)|0x03)        /* set     "        "    "    "    "    "      */
  39. #define F_GPRINTREC        (('e'<<8)|0x04)        /* get print record for file */
  40. #define F_SPRINTREC        (('e'<<8)|0x05)        /* set     "        "    "    "      */
  41. #define F_GSELINFO         (('e'<<8)|0x06)        /* get selection information for file */
  42. #define F_SSELINFO         (('e'<<8)|0x07)        /* set        "        "        "        " */
  43. #define F_GWININFO         (('e'<<8)|0x08)        /* get current window position */
  44. #define F_SWININFO         (('e'<<8)|0x09)        /* set    "        "        "        */
  45. #define F_GSCROLLINFO    (('e'<<8)|0x0A)        /* get scroll information */
  46. #define F_SSCROLLINFO    (('e'<<8)|0x0B)        /* set    "           "        */
  47. #define F_GMARKER        (('e'<<8)|0x0D)        /* Get Marker */
  48. #define F_SMARKER        (('e'<<8)|0x0C)        /* Set   "       */
  49. #define F_GSAVEONCLOSE    (('e'<<8)|0x0F)        /* Get Save on close */
  50. #define F_SSAVEONCLOSE    (('e'<<8)|0x0E)        /* Set   "     "     "      */
  51.  
  52. /*
  53.  *    argument structure for use with F_SMARKER command
  54.  */
  55. struct MarkElement {
  56.     int                start;            /* start position of mark */
  57.     int                end;            /* end position */
  58.     unsigned char    charCount;        /* number of chars in mark name */
  59.     char            name[1];        /* first char of mark name */
  60.                                     /* note: typically extra space is allocated */
  61. } ;                                    /*   in back to allow room for a longer string */
  62. #ifndef __cplusplus
  63. typedef struct MarkElement MarkElement;
  64. #endif
  65.  
  66. /*
  67.  * Mode values accessible to open()
  68.  */
  69. #define O_RDONLY         0         /* Bits 0 and 1 are used internally */
  70. #define O_WRONLY         1         /* Values 0..2 are historical */
  71. #define O_RDWR              2        /* NOTE: it goes 0, 1, 2, *!* 8, 16, 32, ... */
  72. #define O_APPEND    (1<< 3)        /* append (writes guaranteed at the end) */
  73. #define O_RSRC         (1<< 4)        /* Open the resource fork */
  74. #define O_CREAT        (1<< 8)        /* Open with file create */
  75. #define O_TRUNC        (1<< 9)        /* Open with truncation */
  76. #define O_EXCL         (1<<10)     /* w/ O_CREAT Exclusive "create-only" */
  77. #define O_BINARY    (1<<11)     /* Open as a binary stream */
  78.  
  79. #ifdef __cplusplus
  80. extern "C" {
  81. #endif
  82.  
  83. /*
  84.  *        function prototypes
  85.  */
  86. int  close(int);
  87. int  creat(const char*);
  88. int     dup(int filedes);        /* OBSOLETE: fcntl(filedes, F_DUPFD, 0) is preferred */
  89. int     faccess(char*, unsigned int, long*);
  90. int  fcntl(int, unsigned int, int);
  91. long lseek(int, long, int);
  92. int  open(const char*, int);
  93. int  read(int, char*, unsigned);
  94. int  unlink(char*);
  95. int  write(int, const char*, unsigned);
  96.  
  97. #ifdef __cplusplus
  98. }
  99. #endif
  100.  
  101. /*
  102.  * fcntl() commands
  103.  */
  104. #define F_DUPFD 0       /* Duplicate files (file descriptor) */
  105.  
  106. #endif __FCNTL__
  107.